package org.example.controller;

import org.example.pojo.CategoryArticleCountDTO;
import org.example.pojo.ClientAdCountDTO;
import org.example.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//import javax.xml.transform.Result;
import java.util.List;
import org.example.pojo.Result;

@RestController
@RequestMapping("/statistics")
public class StatisticsController {

    @Autowired
    private StatisticsService statisticsService;

    @GetMapping
    public Result<List<ClientAdCountDTO>> getClientAdCounts(){
        List<ClientAdCountDTO> cld = statisticsService.getClientAdCounts();
        return Result.success(cld);
    }

    @GetMapping("/categoryArticle")
    public Result<List<CategoryArticleCountDTO>> getCategoryArticleCounts(){
        List<CategoryArticleCountDTO> cac = statisticsService.getCategoryArticleCounts();
        return Result.success(cac);
    }
}
